package com.qiangesoft.weather.gaode.constant;

/**
 * 天气
 *
 * @author qiangesoft
 * @date 2023-08-11
 */
public enum WeatherType {
    /**
     * https://lbs.amap.com/api/webservice/guide/tools/weather-code
     * 可参考高德天气对照表
     */

    /**
     * 雪
     */
    XUE("xue", "雪"),

    /**
     * 雷
     */
    LEI("lei", "雷"),

    /**
     * 沙尘
     */
    SHA_CHEN("shachen", "沙尘"),

    /**
     * 雾
     */
    WU("wu", "雾"),

    /**
     * 冰雹
     */
    BING_BAO("bingbao", "冰雹"),

    /**
     * 云
     */
    YUN("yun", "云"),

    /**
     * 雨
     */
    YU("yu", "雨"),

    /**
     * 阴
     */
    YIN("yin", "阴"),

    /**
     * 晴
     */
    QING("qing", "晴");

    private String code;

    private String des;


    WeatherType(String code, String des) {
        this.code = code;
        this.des = des;
    }

    public String getCode() {
        return code;
    }

    public String getDes() {
        return des;
    }

    public static String getCodeByDes(String des) {
        for (WeatherType value : values()) {
            if (des.contains(value.getDes())) {
                return value.getCode();
            }
        }
        return "";
    }
}
